#!/usr/bin/env python
from django import forms
from bbs.models import Article


class ArticleForm(forms.ModelForm):
    class Meta:
        model = Article
        fields = ('title', 'brief', 'category', 'content', 'head_img')

        widgets = {
            'title': forms.TextInput(attrs={'placeholder': u'1-20个字符以内', 'class': 'form-control'}),
            'brief': forms.TextInput(attrs={'placeholder': u'1-20个字符以内', 'class': 'form-control'}),
            'content': forms.Textarea(attrs={'id': 'article-content',
                                             'style': 'width:685px;height:500px;',
                                            }),
            'category': forms.Select(attrs={'class': 'form-control'})

        }
    '''
    def __init__(self, *args, **kwargs):
        super(ArticleForm, self).__init__(*args, **kwargs)

        for field_name in self.base_fields:
            field = self.base_fields[field_name]
            field.widget.attrs.update({'class': 'form-control'})
    '''